Micron Document
____ _ _ _ _
| _ \ ___ | |_ (_) _ __ ___ __| | (_) __ _
| |_) | / _ \ | __| | | | '_ \ / _ \ / _| | | | / _ |
| _ < | __/ | |_ | | | |_) | | __/ | (_| | | | | (_| |
|_| \_\ \___| \__| |_| | .__/ \___| \__,_| |_| \__,_|
|_|


The NomadNet German Wikipedia | Archives | Info
- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b

πŸ” Search

Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―

SQLAlchemy
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
top
SQLAlchemy ist ein Open-Source-SQL-Toolkit und ORM-Framework fΓΌr die Programmiersprache Python mit dem Ziel, den Object-relational impedance mismatch in der Art von Javas Hibernate zu umschiffen. SQLAlchemy wurde im Februar 2006 verΓΆffentlicht.

SQLAlchemy bietet eine Reihe von Entwurfsmustern zur effizienten Persistenzhaltung von Daten in einer relationalen Datenbank. Die Motivation hinter SQLAlchemy ist darin begrΓΌndet, dass SQL-Datenbanken umso weniger Objektsammlungen Γ€hneln, je umfangreicher der Datenbestand und je mehr Leistung gefragt ist, wΓ€hrend Objektsammlungen sich weniger wie Relationen und Tupel verhalten, je mehr zwischen DatenreprΓ€sentation und Miniwelt abstrahiert wird. Daher verfolgt SQLAlchemy primΓ€r ein Data Mapper-Muster anstelle eines sogenannten Active Record-Musters. Optionale Plugins ermΓΆglichen weitere Muster, z. B. mit Elixir eine deklarative Syntax.

Contents

β€’ Beispiel
β€’ Siehe auch
β€’ Literatur
β€’ Weblinks

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Beispiel

Erzeugung einer M:N-Beziehung (Autorschaft) zwischen Buch und Autor (ohne imports):

Base = declarative_base()
engine = sqlalchemy.create_engine('postgres://user:pwd@host/dbname', echo=True)
autorschaft = Table('buch_autor', Base.metadata,
Column('isbn', Integer, ForeignKey('buch.isbn')),
Column('kennung', Integer, ForeignKey('autor.kennung'))
)
class Buch(Base):
__tablename__ = 'buch'
isbn = Column(Integer, primary_key=True)
titel = Column(String(255), nullable=False)
klappentext = Column(Text)
autoren = relationship(Autor, secondary=autorschaft, backref='buecher')
class Autor(Base):
__tablename__ = 'autor'
kennung = Column(String(32), primary_key=True)
name = Column(String(50), nullable=False, unique=True)
Base.metadata.create_all(engine)

UnterstΓΌtzte Datenbanken

SQLAlchemy unterstΓΌtzt eine Vielzahl von Datenbankmanagementsystemen:

β€’ Informix IDS
β€’ DB2
β€’ Drizzle
β€’ Firebird
β€’ SAP MaxDB
β€’ MySQL
β€’ PostgreSQL
β€’ SQLite
β€’ Sybase ASE

Siehe auch

β€’ Django (Python Web Framework inkl. ORM)
β€’ Hibernate (Java ORM)

Literatur

β€’ Mark Ramm, Michael Bayer: SQLAlchemy: Database Access Using Python, Addison-Wesley, 2010, ISBN 978-0-13-236467-6
β€’ Rick Copeland: Essential SQLAlchemy, O’Reilly, 2008, ISBN 0-596-51614-2
β€’ Jeremy Jones, Noah Gift: Python for Unix and Linux System Administration, O’Reilly, 2008, ISBN 978-0-596-51582-9

Weblinks

β€’ SQLAlchemy Homepage
β€’ SQLAlchemy Plugins
β€’ SQLAlchemy Liste unterstΓΌtzter Datenbanksysteme